package me.zhengjie.dailyPoem.domain;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.bean.copier.CopyOptions;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.List;

/**
* @description /
* @author yellow
* @date 2025-04-21
**/
@Data
@TableName("daily_poem_discussion")
public class DailyPoemDiscussion implements Serializable {

    @TableId(value = "discussion_id", type = IdType.AUTO)
    @ApiModelProperty(value = "主键")
    private Integer discussionId;

    @ApiModelProperty(value = "关联的诗歌ID")
    private Integer poemId;

    @ApiModelProperty(value = "用户ID")
    private Integer userId;

    @ApiModelProperty(value = "用户名")
    private String userName;

    @ApiModelProperty(value = "评论内容")
    private String content;

    @ApiModelProperty(value = "点赞数")
    private Integer likeCount;

    @ApiModelProperty(value = "子评论数")
    private Integer commentCount;

    @ApiModelProperty(value = "是否置顶")
    private Integer isPinned;

    @ApiModelProperty(value = "状态：1=正常，0=删除，2=审核中")
    private Integer status;

    @ApiModelProperty(value = "创建时间")
    private Timestamp createdAt;

    @ApiModelProperty(value = "更新时间")
    private Timestamp updatedAt;

    @TableField(exist = false)
    @ApiModelProperty(value = "子评论列表")
    private List<DailyPoemDiscussion> children;

    public void copy(DailyPoemDiscussion source){
        BeanUtil.copyProperties(source,this, CopyOptions.create().setIgnoreNullValue(true));
    }
}
